UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ozBZ8IubLLBowbeUaAptTv3YBvJlUTBn81jZeiVtCTo='
WHERE
key_id = '8362bd240b0facb5abed11d32558af1e183304ec85e80e8c54f7a5397c876f2e'
AND (
token = 'ozBZ8IubLLBowbeUaAptTv3YBvJlUTBn81jZeiVtCTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)