UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R3eGKzDhn1fkEJqiG42O4Sp5aGpxmodXQVpo5sDjxBg='
WHERE
key_id = '916d163dc7c66547207f4b032976291fe67f5ab09b1cd497687a4a57ed5a4d9e'
AND (
token = 'R3eGKzDhn1fkEJqiG42O4Sp5aGpxmodXQVpo5sDjxBg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)