UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XkaXnWCNdfbswX7ZnCUPq4jckGshI+AIr48a0upqYAg='
WHERE
key_id = '146e8757b10abf72f32b511a5a4c7666c9cd842db83d63cebbc4e386b21ac6e1'
AND (
token = 'XkaXnWCNdfbswX7ZnCUPq4jckGshI+AIr48a0upqYAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)