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