UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tfkEPsYNlHHUldPxzX3vkVCgUHQ2tbgEgSAoMh6tdhM='
WHERE
key_id = '00ccd65fa6856801f01c207e004d392812519c96f9f9b05fca49b0b33894eeb2'
AND (
token = 'tfkEPsYNlHHUldPxzX3vkVCgUHQ2tbgEgSAoMh6tdhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)