UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oryuuA9vGJ2jwI1CaBTyRngEeTF2t81mhj7hwJhThdE=' 
WHERE 
  key_id = '0348877835d2995c7f875043f44201f316f06fe4034f7afcd9d894bb07875b4e' 
  AND (
    token = 'oryuuA9vGJ2jwI1CaBTyRngEeTF2t81mhj7hwJhThdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030