UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EhyDa0mU54umHjxcMhAyacCKwS8TpLP1GB+QH9Dyvj0='
WHERE
key_id = '57a11ae295fe167a8920dcd3bce1844b7ff849e5e7f6370a3e1d927aeeb67eb1'
AND (
token = 'EhyDa0mU54umHjxcMhAyacCKwS8TpLP1GB+QH9Dyvj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)