UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8kKJpyjALlt6tywjCiJg3ujKAF59rf3Lh1aYZsj0ENI='
WHERE
key_id = '57503c08aae1efc07f669289b1b84cf4f9f1ff65b8b84179826991a9bc1aa85b'
AND (
token = '8kKJpyjALlt6tywjCiJg3ujKAF59rf3Lh1aYZsj0ENI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)