UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qosheu5gXU1zscEEBcRlQmJtsOnDnzDayaqIgf+0KuY='
WHERE
key_id = 'c65112d8c8b069cfe39d101a2cabb90a079f6864bc50baa5b1f159638596e95b'
AND (
token = 'qosheu5gXU1zscEEBcRlQmJtsOnDnzDayaqIgf+0KuY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)