UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'koKlhXMS6cfB+Di4vaYl6UADGoHWUAB98rAipVyGHKM=' 
WHERE 
  key_id = '4fb91d95622d66eeecdf15664d62bb748a37f3e422213696a1b82edb241a91f1' 
  AND (
    token = 'koKlhXMS6cfB+Di4vaYl6UADGoHWUAB98rAipVyGHKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020