UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v14t1RJ/pytky67ac3j5LufS9bRpVRpRA9wYcZiyJ4s='
WHERE
key_id = 'd3bce9491c47f7984b0bc7f714fe30f1755307d608faa314baf5e504aa9a289d'
AND (
token = 'v14t1RJ/pytky67ac3j5LufS9bRpVRpRA9wYcZiyJ4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)