UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wmMcPWu3HOiz5ZpgtApXZjvfERhbceoozPnOI6iXNlE='
WHERE
key_id = '123c9b50ef5c8cc91977682d21d5a08a01621eb343c085ab0640a48d77c7d58d'
AND (
token = 'wmMcPWu3HOiz5ZpgtApXZjvfERhbceoozPnOI6iXNlE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)