UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eqS22oWqkbPSQo3TKW8gx82kjt3dUnR+UCHANAjsqI4='
WHERE
key_id = '5248d39978db76c6c1bf9a07e62b988ae53b6e03a9c676d803f2ec41f77ff93f'
AND (
token = 'eqS22oWqkbPSQo3TKW8gx82kjt3dUnR+UCHANAjsqI4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)