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