UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7IH5ONvxyrzMjuyPiTS3mdqMzPPEsfz0wfqsynlFsFU=' 
WHERE 
  key_id = '784bbf68f80f77271ca8a9a6752a8e9ce63133c86186c0069f5dd59db828a962' 
  AND (
    token = '7IH5ONvxyrzMjuyPiTS3mdqMzPPEsfz0wfqsynlFsFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032