UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kL7PpGPWr9CYZyXvqmlqltn5sYoYlbFjcw9n6H8npa0='
WHERE
key_id = 'eeeb1adb640ae404805bba59517ad1588c18aa184570a6392e891a68820327a8'
AND (
token = 'kL7PpGPWr9CYZyXvqmlqltn5sYoYlbFjcw9n6H8npa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)