UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GH+CzyX2mmFEliFxjLAAYByuBOouceYhn5y4gdO6gvg=' 
WHERE 
  key_id = '5d507579a1598740413126dfe323230809b0603a133b8920c037bb97c9e01367' 
  AND (
    token = 'GH+CzyX2mmFEliFxjLAAYByuBOouceYhn5y4gdO6gvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034