UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'My4Jkk0LS3x7xlokc1+QVc2Yd505zlHT43PHRuVBCe8='
WHERE
key_id = 'aa0b88a6090d64b7f5e9fdb6799590bc68bf02db07f5804a5d2627fdeba279e5'
AND (
token = 'My4Jkk0LS3x7xlokc1+QVc2Yd505zlHT43PHRuVBCe8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)