UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ohk0wpS+6x3B7GmfCaff9Tbe4c0k8FFUaNymQkB8sE='
WHERE
key_id = '783f805c83d6c8d3e37e4a0a791e0171bdd3119c7fb1ab56ade9cfc45f39f6bb'
AND (
token = '7ohk0wpS+6x3B7GmfCaff9Tbe4c0k8FFUaNymQkB8sE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)