UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hM85qNUCVfj1yuO9H1k9Ta8dhtWDAbOH8ksq8mprzmc=' 
WHERE 
  key_id = '68c07dadc6ca7a89d7729b98e52da5578c837d8b605d2973742109414b720af9' 
  AND (
    token = 'hM85qNUCVfj1yuO9H1k9Ta8dhtWDAbOH8ksq8mprzmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018