UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Bk94n+4jAgbP0w5EU23MCK59g2DO089O0AwPl2L0K8=' 
WHERE 
  key_id = '8f13d7d6c47c24ba07e5cf05983bd641e292a51b566d7865d89910cd6d0fa643' 
  AND (
    token = '6Bk94n+4jAgbP0w5EU23MCK59g2DO089O0AwPl2L0K8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028