UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZRd/+WEDi0rhzQr8nOwo5MfXgoh6JkdGsvXa6XRNbX4=' 
WHERE 
  key_id = '37b21b3d2dd99b192bb28c78f2cb85e31632457c0cd132ee96831485125c0ba7' 
  AND (
    token = 'ZRd/+WEDi0rhzQr8nOwo5MfXgoh6JkdGsvXa6XRNbX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078