UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1dL7vVajg6mGTp5XLryAfbzG+FEZwEAMlmdplHvpz6E=' 
WHERE 
  key_id = '1c1ca02248eb9bc6e9f50e1cb9f7934ed55688437e81df11f464aa03f2982000' 
  AND (
    token = '1dL7vVajg6mGTp5XLryAfbzG+FEZwEAMlmdplHvpz6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028