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