UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UnL0395c/w3F5/BE13kRRdkJShsNVBOFjVqoGBKUWVQ='
WHERE
key_id = '9b143c0d1a996cc0bd6f7e18b1fb18d0273b79d899d2b00d1a8edec7e361633d'
AND (
token = 'UnL0395c/w3F5/BE13kRRdkJShsNVBOFjVqoGBKUWVQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)