UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xf3Wgd12JMIKjECbAYXZL9UvbSpCI2pBtrNzExuJ9Hc='
WHERE
key_id = '21651c6c7baa91592167233b71adc5323dbd5383d2baf6ddd89ca239a0f91a5e'
AND (
token = 'Xf3Wgd12JMIKjECbAYXZL9UvbSpCI2pBtrNzExuJ9Hc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)