UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BHkl3F/ndRLArN4/2oYdQdyjdfrKwYh4uzX0kUmIunk='
WHERE
key_id = '9e7d631b0f6411debfc0cc724833eff91cef701cb72ebf17e6465e91ca64e992'
AND (
token = 'BHkl3F/ndRLArN4/2oYdQdyjdfrKwYh4uzX0kUmIunk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)