UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/ch1iR6LpUisrFZrA9RanuOOozeFAYVt2J4C36VNHY=' 
WHERE 
  key_id = '34ecd279c29a41d3b0580414b94cf0bea88f2fac537da47d2152d904967a2066' 
  AND (
    token = 'v/ch1iR6LpUisrFZrA9RanuOOozeFAYVt2J4C36VNHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032