UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRw/tRSQhLFHK49AioIbW1emzbBLM4R8sZ8P+8F6RRU='
WHERE
key_id = 'c970221793443cc322405f0e7f3a9ef82e3bdd72956ac04025b2f8382127507e'
AND (
token = 'aRw/tRSQhLFHK49AioIbW1emzbBLM4R8sZ8P+8F6RRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)