UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KA5ojMMMBj2rGXDxa2qWR19FtGDRGimaqa6Nta5875s=' 
WHERE 
  key_id = '9b727fad2794f05f00aac71e5a2b3e02d540ea3c4a790280bf612ebe60ae6f1b' 
  AND (
    token = 'KA5ojMMMBj2rGXDxa2qWR19FtGDRGimaqa6Nta5875s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046