UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jWU6F6kI5KHEfDA9Wn8guM4JCQ5qHZQxLOVKPYGXHTA='
WHERE
key_id = 'f43128928488c172eb4de2acb4e84f8f5a63746803cedeb73a461056b7860cdc'
AND (
token = 'jWU6F6kI5KHEfDA9Wn8guM4JCQ5qHZQxLOVKPYGXHTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)