UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aNinAiw9vIeZq2qIA9IC5f+IHVpk8DfLpfIepiq1FM4='
WHERE
key_id = '110fcbf728136382f6328a439e822e88c56da1e1fa354596adcf7945427662cb'
AND (
token = 'aNinAiw9vIeZq2qIA9IC5f+IHVpk8DfLpfIepiq1FM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)