UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'my+fiKzdgVGQPa1BYyIAWkFeQlrcS0dFkeEN4PzxiZs=' 
WHERE 
  key_id = 'ee0615f6cb45743d146e8592da7c75a03241747881b933e0b70a09ba65cbc5a1' 
  AND (
    token = 'my+fiKzdgVGQPa1BYyIAWkFeQlrcS0dFkeEN4PzxiZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025