UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aPODbN84NLTXgsADIsmD+XBNGCH2fqDyFTkV4U+40HI=' 
WHERE 
  key_id = 'e021730d64da92ffced8833531b505a6758b41d098fd35c96b81069c5f56899e' 
  AND (
    token = 'aPODbN84NLTXgsADIsmD+XBNGCH2fqDyFTkV4U+40HI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035